home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / unouter.tex < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.6 KB  |  37 lines

  1. % unouter.tex - remove the concept of \outer from plain TeX
  2. % By Eamonn McManus Nov 88.  This file is not copyrighted.
  3.  
  4. % This macro removes the outerness of the control sequence \csname#1\endcsname
  5. % by copying it to \csname un*#1\endcsname and then defining
  6. % \csname#1\endcsname to be a macro that expands to that.  For example,
  7. % after \unouter{proclaim}, we have: \proclaim=macro:->\un*proclaim .
  8. % and \un*proclaim=\outer macro:->[original definition of \proclaim] .
  9. % It would be nice if we could avoid this extra level, but I know of no way
  10. % of doing that short of writing the \meaning to a file and reading that in
  11. % again (yeuch).
  12. \def\unouter#1{\toks0=\expandafter{\csname un*#1\endcsname}%
  13.     \edef\next{\let\the\toks0=}\expandafter\next\csname#1\endcsname
  14.     \expandafter\edef\csname#1\endcsname{\the\toks0}}
  15.  
  16. % In the case where the macro has no parameter text, we can unouter it
  17. % directly by putting its expansion into a token list and redefining it
  18. % in terms of that expansion.
  19. \def\simpunouter#1{%
  20.     \toks0=\expandafter\expandafter\expandafter{\csname#1\endcsname}%
  21.     \expandafter\edef\csname#1\endcsname{\the\toks0}}
  22.  
  23. % ^^L is defined as \outer\par
  24. \let^^L=\par
  25.  
  26. % Change everything else defined as \outer.
  27. \simpunouter{newcount} \simpunouter{newdimen} \simpunouter{newskip}
  28. \simpunouter{newmuskip} \simpunouter{newbox} \simpunouter{newtoks}
  29. \simpunouter{newread} \simpunouter{newwrite} \simpunouter{newfam}
  30. \simpunouter{+} \simpunouter{bye}
  31. \unouter{newhelp} \unouter{newif} \unouter{beginsection} \unouter{proclaim}
  32.  
  33. % \unouter no longer needed, and remove the offending primitive!
  34. \let\unouter=\undefined \let\simpunouter=\undefined \let\outer=\relax
  35.  
  36. \endinput
  37.